
import * as React from 'react';
import { View, Text,Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import LoginScreen from './pages/account/login';
import { WebView } from 'react-native-webview';

const Stack = createStackNavigator();
function DetailsScreen() {
  return (
    <WebView source={{ uri: "https://sina.com.cn"}} style={{color: 'red'}}>
        <Text>Screen</Text>   
      </WebView>
  );
}
function HomeScreen(obj) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <Button
        title="Go to Details"
        onPress={() => obj.navigation.navigate('Details')}
      />
      <Button
        title="Go to Login"
        onPress={() => obj.navigation.navigate('Login')}
      />
    </View>
  );
}
function Nav() {
  return (
    <NavigationContainer>
      <Stack.Navigator 
        screenOptions={{
          headerShown: false
        }}
        initialRouteName="Home">
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
        <Stack.Screen name="Login" component={LoginScreen}></Stack.Screen>
      </Stack.Navigator>
    </NavigationContainer>
  ); 
}

export default Nav;